package admin

import (
	"context"
	"server/internal/service"

	"server/api/admin/system"
)

func (c *ControllerSystem) AuthorityDetail(ctx context.Context, req *system.AuthorityDetailReq) (res *system.AuthorityDetailRes, err error) {
	res = new(system.AuthorityDetailRes)
	authData, err := service.SystemAuthority().GetUserAuthData(ctx, service.SystemLogin().GetAdminID(ctx))
	res.Permissions = authData.PermissionCodes
	res.Menus = authData.MenuCodes
	res.ID = authData.Id
	res.Username = authData.Username
	res.Name = authData.Name
	res.Phone = authData.Phone
	return
}
